import Mock from 'mockjs';

let list_data=Mock.mock({
  "list|100":[
    {
      "id|+1":1,
      title:"@title",
      pic:"@image(100X100,@color,@city)"
    }
  ]
})

Mock.mock('/api/list',{
  code:0,
  data:list_data.list
})

Mock.mock('/api/login','post',(options)=>{
  let {username,password}=JSON.parse(options.body);
  console.log('username',username);
  console.log('password',password);
  if(username==='admin' && password==='123456'){
    return {
      code:0,
      message:'login successfully',
      token:'admin'+new Date().getTime()
    }
  }else{
    return {
      code:1,
      message:'login error',
      token:''
    }
  }
})